package cn.crism.blog.conver;

import cn.crism.blog.entity.Comment;
import cn.crism.blog.entity.Reply;
import cn.crism.blog.param.CommentParam;

import java.util.Date;

/**
 * @Author: Crism
 * @Date: 下午2:56 18/2/9
 * @Description:
 */

public class CommentConver {
    public static Reply toReply(CommentParam commentParam){
        Reply reply = new Reply();
        reply.setFromEmail(commentParam.getEmail());
        reply.setFromName(commentParam.getFromName());
        reply.setReplyContent(commentParam.getContent());
        reply.setToName(commentParam.getToName());
        reply.setReplyTime(new Date());
        return reply;
    }

    public static Comment toComment(CommentParam commentParam){
        Comment comment = new Comment();
        comment.setArticleId(commentParam.getArticleId());
        comment.setCommenterEmail(commentParam.getEmail());
        comment.setCommentContent(commentParam.getContent());
        comment.setCommenterName(commentParam.getFromName());
        comment.setCommentTime(new Date());
        return comment;
    }
}
